<?php

namespace App\Http\Controllers;

use App\Library\Requests\UserAccount\UserAccountAddRequest;
use App\Library\Requests\UserAccount\UserAccountReleaseRequest;
use App\Library\Requests\UserAccount\UserAccountWechatPayRequest;
use App\Library\Service\UserAccountService;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Http\JsonResponse;

class UserAccountController extends BaseController
{
    /**
     * @param UserAccountService $service
     */
    public function __construct(UserAccountService $service)
    {
        $this->service = $service;
    }

    /**
     * 添加绑定
     * @param UserAccountAddRequest $request
     * @return JsonResponse
     * @throws GuzzleException
     *
     */
    public function add(UserAccountAddRequest $request): JsonResponse
    {
        return $this->service->add($request);
    }

    /**
     * 解除绑定
     * @param UserAccountReleaseRequest $request
     * @return JsonResponse
     *
     */
    public function release(UserAccountReleaseRequest $request): JsonResponse
    {
        return $this->service->release($request);
    }

    /**
     * list
     * @return JsonResponse
     *
     */
    public function list(): JsonResponse
    {
        return $this->service->list();
    }

    /**
     * 绑定微信提现
     * @param UserAccountWechatPayRequest $request
     * @return JsonResponse
     * @throws GuzzleException
     */
    public function wechat(UserAccountWechatPayRequest $request): JsonResponse
    {
        return $this->service->wechat($request);
    }
}
